package com.remote.common;

import com.remote.common.command.Commands;
import com.remote.common.command.handler.ICommandHandler;
import com.remote.common.exception.RemoteException;
import com.remote.common.model.ServerClientInfo;

import java.util.concurrent.ScheduledExecutorService;

public interface RemoteFactory {
    /**
     * 设置定时器
     *
     * @param scheduledExecutorService
     */
    void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService);

    /**
     * 注册命令处理器
     *
     * @param commandsEnum
     * @param commandHandler
     */
    void registerHandler(Enum<Commands> commandsEnum, ICommandHandler commandHandler);

    /**
     * 添加客户端
     *
     * @param clientInfo
     * @throws RemoteException
     */
    void addClient(ServerClientInfo clientInfo) throws RemoteException;


    /**
     * 判断客户端是否存在
     *
     * @param controlClient
     * @return
     */
    boolean hasClient(String controlClient);

    /**
     * 移除客户端
     *
     * @param controlClient
     */
    void removeClient(String controlClient);

    /**
     * 连接客户端
     *
     * @param clientId
     * @return
     * @throws RemoteException
     */
    ServerClientInfo getClient(String clientId) throws RemoteException;

    /**
     * 获取命令处理器
     *
     * @param commandsEnum
     * @return
     */
    ICommandHandler getCommandHandler(Enum<Commands> commandsEnum);

    /**
     * 生成客户端ID
     *
     * @return
     */
    String generateClientId();

    /**
     * 获取配置
     *
     * @return
     */
    RemoteConfiguration getRemoteConfiguration();


}
